<?php

namespace app\system\model\daily;

use think\Model;

/**
 * Goods
 */
class Suborder extends Model {

    public $name = 'daily_suborder';

    public $append = ['status_text'];

    public function goods(){
        return $this->hasOne(Goods::class, 'id', 'goods_id');
    }

    /**
     * 获取订单状态
     */
    public function getStatusTextAttr($value, $data) {
        $status = [
            -1 => '取消订单',
            0 => '待付款',
            1 => '未付款待定',
            2 => '已付款待定',
            3 => '已付款',
            4 => '已发货',
            5 => '已收货',
            6 => '退款/售后',
            7 => '待定',
            999 => '已完成',
        ];
        return $status[$data['status']];
    }


}


